package com.ztsoft.user.config.shiro;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import java.util.Properties;

/**
 * 无权限跳转
 */
@Configuration
public class ExceptionConfig {
    @Bean
    public SimpleMappingExceptionResolver resolver() {
        SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver();
        Properties properties = new Properties();
        //配置所有的抛出无权限异常的页面
        properties.setProperty("org.apache.shiro.authz.UnauthorizedException", "/user/noAuth");
        resolver.setExceptionMappings(properties);
        return resolver;
    }
}